import request from '@/utils/request'

export function getArticlelist (params) {
  return request({
    url: '/v1_1/articles',
    params
  })
}
// 获取文章详情
export function getArticleDetails (id) {
  return request({
    url: '/v1_0/articles/' + id

  })
}
// 关注用户
export function followuser (id) {
  return request({
    url: '/v1_0/user/followings',
    method: 'POST',
    data: {
      target: id
    }

  })
}

// 取消关注
export function cancelfollow (id) {
  return request({
    url: '/v1_0/user/followings/' + id,
    method: 'DELETE'
  })
}
// 收藏文章
export function collectarticle (target) {
  return request({
    url: '/v1_0/article/collections',
    method: 'POST',
    data: {
      target
    }
  })
}
// 取消收藏
export function cancelcollect (target) {
  return request({
    url: '/v1_0/article/collections/' + target,
    method: 'DELETE'
  })
}
// 获取文章评论
export function getCommentList (data) {
  return request({
    url: '/v1_0/comments',
    method: 'get',
    params: data
  })
}

// 对文章进行评论或者评论进行评论
export function getCommentToComment (data) {
  return request({
    url: '/v1_0/comments',
    method: 'post',
    data
  })
}
